package com.zbj.springboot.mybatis.controller;

import com.zbj.springboot.mybatis.dao.entity.DeveloperInfo;
import com.zbj.springboot.mybatis.service.DeveloperInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * DeveloperInfoController
 *
 * @author weigang
 * @create 2018-04-17
 **/
@RestController
@RequestMapping(value = "developer")
public class DeveloperInfoController {

    @Autowired
    private DeveloperInfoService developerInfoService;

    @GetMapping("update.json")
    public int update() {
        DeveloperInfo info = new DeveloperInfo();
        info.setDeveloperId(1000007474L);
        info.setUpdateTime(new Date());
        return developerInfoService.update(info);
    }

    @GetMapping("list.json")
    public List<DeveloperInfo> list() {

        DeveloperInfo info = new DeveloperInfo();
        info.setValid((byte) 1);
        return developerInfoService.list(info);
    }
}